package com.hashnode.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class GatewayConfig {
    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder routeLocatorBuilder){
        RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();

        routes.route("path_route_route1",
                r->r.path("/v/douga")
                        .uri("http://www.bilibili.com"));
        return routes.build();
    }

//    @Bean
//    public RouteLocator paymentRouteLocator(RouteLocatorBuilder routeLocatorBuilder){
//        RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();
//
//        routes.route("path_route_route2",
//                r->r.path("/payment/get/**")
//                        .uri("http://localhost:8001"));
//        return routes.build();
//    }
}
